]> git.r.bdr.sh - rbdr/super-polarity/blobdiff - Super Polarity/SuperPolarity.cs
I have the worst commits ever.
[rbdr/super-polarity] / Super Polarity / SuperPolarity.cs
index b590079bf248f065530b48775c10083b6013c8c4..6689167f16aed7939c044b54e4fffdcc08cf1d7a 100644 (file)
@@ -17,16 +17,33 @@ namespace SuperPolarity
     /// </summary>
     public class SuperPolarity : Game
     {
-        public static GraphicsDeviceManager graphics;
+        public GraphicsDeviceManager graphics;
         SpriteBatch spriteBatch;
 
+        public static int OutlierBounds;
+
+        public Player Player;
+
+        Screen EntryScreen;
+
+        SpriteFont DebugFont;
+
         public SuperPolarity()
             : base()
         {
-            SuperPolarity.graphics = new GraphicsDeviceManager(this);
-            SuperPolarity.graphics.PreferMultiSampling = true;
+            graphics = new GraphicsDeviceManager(this);
+            graphics.PreferMultiSampling = true;
+            graphics.PreferredBackBufferWidth = 1280;
+            graphics.PreferredBackBufferHeight = 720;
+            graphics.ToggleFullScreen();
+
             Content.RootDirectory = "Content";
             ActorFactory.SetGame(this);
+            ParticleEffectFactory.SetGame(this);
+            ActorManager.SetGame(this);
+            ScreenManager.SetGame(this);
+
+            EntryScreen = (Screen)new GameScreen(this);
         }
 
         /// <summary>
@@ -39,11 +56,19 @@ namespace SuperPolarity
         {
             base.Initialize();
 
-            InputController.RegisterEventForButton("changePolarity", Buttons.A);
-            InputController.RegisterEventForKey("changePolarity", Keys.Z);
+            InputController.RegisterEventForKey("fullScreenToggle", Keys.F11);
+            InputController.Bind("fullScreenToggle", HandleFullScreenToggle);
 
-            InputController.RegisterEventForButton("shoot", Buttons.X);
-            InputController.RegisterEventForKey("shoot", Keys.X);
+            EntryScreen.Initialize();
+            ScreenManager.Push(EntryScreen);
+
+            OutlierBounds = 100;
+        }
+
+        protected void HandleFullScreenToggle(float value)
+        {
+            graphics.ToggleFullScreen();
+            graphics.ApplyChanges();
         }
 
         /// <summary>
@@ -55,11 +80,10 @@ namespace SuperPolarity
             // Create a new SpriteBatch, which can be used to draw textures.
             spriteBatch = new SpriteBatch(GraphicsDevice);
 
-            Vector2 playerPosition = new Vector2(GraphicsDevice.Viewport.TitleSafeArea.X, GraphicsDevice.Viewport.TitleSafeArea.Y + GraphicsDevice.Viewport.TitleSafeArea.Height / 2);
+            EntryScreen.LoadContent();
 
-            ActorFactory.CreateShip(Ship.Polarity.Positive, new Vector2(200, 200));
-            ActorFactory.CreateShip(Ship.Polarity.Negative, new Vector2(400, 200));
-            ActorFactory.CreateMainShip(playerPosition);
+            Player = new Player();
+            DebugFont = Content.Load<SpriteFont>("Fonts\\SegoeUIMono14");
         }
 
         /// <summary>
@@ -81,10 +105,7 @@ namespace SuperPolarity
             if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape))
                 Exit();
 
-            // TODO: Add your update logic here
-
-            InputController.UpdateInput();
-            ActorManager.Update(gameTime);
+            ScreenManager.Update(gameTime);
 
             base.Update(gameTime);
         }
@@ -99,7 +120,11 @@ namespace SuperPolarity
 
             spriteBatch.Begin();
 
-            ActorManager.Draw(spriteBatch);
+            ScreenManager.Draw(spriteBatch);
+
+            spriteBatch.DrawString(DebugFont, "Score: " + Player.Score.ToString(), new Vector2(10, 10), Color.LightGray);
+            spriteBatch.DrawString(DebugFont, "Multiplier: " + Player.Multiplier.ToString(), new Vector2(10, 30), Color.LightGray);
+            spriteBatch.DrawString(DebugFont, "Lives: " + Player.Lives.ToString(), new Vector2(10, 50), Color.LightGray);
 
             spriteBatch.End();